package de.scs.beans;

import java.util.Arrays;
import java.util.LinkedList;

import de.scs.constants.BloodSugarLevelConstants;

public class InsulinPump
{

  private int                 measurementPeriod   = 0;
  private int                 hardwareCheckPeriod = 0;
  private boolean             powerSupplyWorking  = true;
  private boolean             sensorWorking       = true;
  private boolean             pumpWorking         = true;
  private boolean             needleWorking       = true;
  private boolean             batteryCharged      = true;
  private boolean             insulinFilled       = true;
  private LinkedList<Integer> bloodSugarList      = new LinkedList<Integer>(Arrays.asList(
                                                    BloodSugarLevelConstants.MINIMUM_SAFE_LEVEL,
                                                    BloodSugarLevelConstants.MAXIMUM_SAFE_LEVEL,
                                                    BloodSugarLevelConstants.TARGET_LEVEL));

  public int getMeasurementPeriod()
  {
    return measurementPeriod;
  }

  public void setMeasurementPeriod(int measurementPeriod)
  {
    this.measurementPeriod = measurementPeriod;
  }

  public int getHardwareCheckPeriod()
  {
    return hardwareCheckPeriod;
  }

  public void setHardwareCheckPeriod(int hardwareCheckPeriod)
  {
    this.hardwareCheckPeriod = hardwareCheckPeriod;
  }

  public boolean isPowerSupplyWorking()
  {
    return powerSupplyWorking;
  }

  public void setPowerSupplyWorking(boolean powerSupplyWorking)
  {
    this.powerSupplyWorking = powerSupplyWorking;
  }

  public boolean isSensorWorking()
  {
    return sensorWorking;
  }

  public void setSensorWorking(boolean sensorWorking)
  {
    this.sensorWorking = sensorWorking;
  }

  public boolean isPumpWorking()
  {
    return pumpWorking;
  }

  public void setPumpWorking(boolean pumpWorking)
  {
    this.pumpWorking = pumpWorking;
  }

  public boolean isNeedleWorking()
  {
    return needleWorking;
  }

  public void setNeedleWorking(boolean needleWorking)
  {
    this.needleWorking = needleWorking;
  }

  public Integer getBloodSugarValue(Integer index)
  {
    return bloodSugarList.get(index);
  }

  public void setBloodSugarValue(Integer newBloodSugarLevel)
  {
    bloodSugarList.add(newBloodSugarLevel);
    bloodSugarList.remove(0);
  }

  public boolean isBatteryCharged()
  {
    return batteryCharged;
  }

  public void setBatteryCharged(boolean batteryCharged)
  {
    this.batteryCharged = batteryCharged;
  }

  public boolean isInsulinFilled()
  {
    return insulinFilled;
  }

  public void setInsulinFilled(boolean insulinFilled)
  {
    this.insulinFilled = insulinFilled;
  }

}
